package g2.routemaster.gui.general;

import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.graphics.RGB;
import org.eclipse.swt.widgets.Display;

public class ImageRegistry {
	public static Image getCity(ECityCard card) {
		return new Image(Display.getCurrent(), new ImageRegistry().getClass()
				.getResourceAsStream(card.imagePath()));
	}

	public static Image getPlaceHere() {
		return new Image(Display.getCurrent(), new ImageRegistry().getClass()
				.getResourceAsStream("/pic/placecard.png"));
	}
	
   public static RGB getPlayerRGB(String color){
      String red = color.substring(1, color.indexOf(","));
      String green = color.substring(color.indexOf(",")+1, color.lastIndexOf(","));
      String blue = color.substring(color.lastIndexOf(",")+1, color.length()-1);
      return new RGB(Integer.valueOf(red), Integer.valueOf(green), Integer.valueOf(blue));
   }
}
